export const UrlRequest = (url:string, methods: string, header:string, data: any = {}, newfun?:any)=>{
  return new Promise((resolve, reject)=>{
    wx.request({
      "url": url,
      "method": methods,
      data: data,
      header: {
        "Authorization": `Bearer ${header}`
      },
      success(res:any){
        // console.log(res.data)
        resolve(res.data.data.records) //返回请求成功的数据
        newfun?newfun():newfun
      },
      fail(error){
        wx.showToast({
          title: "请求失败",
          icon: "none",
        })
        reject(error)
      }
    })
  })
}